class animal:
    def __init__(self, name):
        self.name = name

    def run(self):
       pass#空方法


class rabbit(animal):
    def run(self):
        return f'{self.name}用四条腿跑'
    def __str__(self):
        return f"这是一只兔子，他的名字叫{self.name}"

class eagle(animal):
    def run(self):
        return f'{self.name}翅膀飞'
    def __str__(self):#重写了object的方法
        return f"这是一只老鹰，名字叫{self.name}"

if __name__ == "__main__":
    rabbit = rabbit('彼得兔')
    eagle = eagle('老布朗')

    print(rabbit.run())
    print(eagle.run())
    print(rabbit)
    print(eagle)